//
//  MXCustomerServicePopViewCell.swift
//  d11
//
//  Created by peale_pro on 2019/10/15.
//  Copyright © 2019 Tech_001. All rights reserved.
//

import UIKit

class MXCustomerServicePopViewCell: UITableViewCell {
    var bgImgView : UIImageView?
    var iconImgView : UIImageView?
    var titleLabel : UILabel?
    var arrowImgView : UIImageView?
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.setUpUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
    
    func setUpUI() -> Void {
        self.backgroundColor  = UIColor.clear
        self.selectionStyle = UITableViewCell.SelectionStyle.none
       // self.contentView!.backgroundColor  = UIColor.clear
        self.bgImgView = UIImageView.init()
        self.bgImgView?.backgroundColor = UIColor.white
        self.bgImgView?.layer.cornerRadius = 5;
        self.bgImgView?.layer.masksToBounds = true
        self.contentView.addSubview(bgImgView!);
        self.bgImgView?.snp.makeConstraints{(make) in
            make.width.equalToSuperview()
            make.height.equalTo(51)
            make.top.equalToSuperview()
            make.centerX.equalToSuperview()
        };
        
        self.iconImgView = UIImageView.init()
        self.iconImgView?.image = imageNamed("icon_kefu_cell_kefu")
        self.bgImgView?.addSubview(self.iconImgView!)
        self.iconImgView?.snp.makeConstraints{(make) in
            make.left.equalToSuperview().offset(12)
            make.width.equalTo(27)
            make.height.equalTo(27)
            make.centerY.equalTo(self.bgImgView!)
        }
        self.titleLabel = UILabel.init()
        self.titleLabel?.textColor = HexRGBAlpha(0x333333, 1)
        self.titleLabel?.font = UIFont.systemFont(ofSize: 15)
        self.titleLabel?.textAlignment = NSTextAlignment.left
        self.titleLabel?.text = "在线客服"
        self.bgImgView?.addSubview(self.titleLabel!)
        
        self.titleLabel?.snp.makeConstraints{(make) in
            make.left.equalTo((self.iconImgView?.snp.right)!).offset(12)
            make.width.equalTo(100)
            make.height.equalTo(51)
        }
        
        
        self.arrowImgView = UIImageView.init()
        self.arrowImgView?.image = imageNamed("icon_kefu_cell_arrow")
        self.bgImgView?.addSubview(self.arrowImgView!)
        
        self.arrowImgView?.snp.makeConstraints{(make) in
            make.right.equalToSuperview().offset(-20)
            make.width.equalTo(9)
            make.centerY.equalTo(self.bgImgView!)
            make.height.equalTo(15)
        }
        
    }
    
    func setData(dataDict:[String:Any]) -> Void {
        self.iconImgView?.image = imageNamed(dataDict["icon"] as? String ?? "")
        self.titleLabel?.text = dataDict["title"] as? String ?? ""
    }

}
